class CreateOpcoesDipj < ActiveRecord::Migration
  def self.up
    create_table :opcoes_dipj do |t|
      t.integer :ano_apuracao, :ano_dipj, :null => false
      t.decimal :reducao, :precision => 14, :scale => 2, :null => false
      t.references :caracterizacao, :null => false

      t.timestamps
    end
    add_index :opcoes_dipj, :caracterizacao_id
    add_index :opcoes_dipj, [:caracterizacao_id, :ano_apuracao], :unique => true
  end

  def self.down
    drop_table :opcoes_dipj
  end
end
